#include "GMClientDc.h"
#include "Factory.h"
#include "TimerMS.h"
#include "SendGameMessage.h"
#include "ClientPlayerManager.h"

#include <iostream>

GMClientDc::GMClientDc()
{
	m_id = -1;
}

void GMClientDc::Execute()
{
	// called on client
	TheCPManager::Instance()->RemoveClient(m_id);
}

bool GMClientDc::Read(SocketMessage* sm)
{
	// called on client
	sm->ReadInt(&m_id);
	int ts = 0;
	sm->ReadInt(&ts);
	m_timeStamp = (unsigned int)ts;
	std::cout << "GMClientDc::Read()" << std::endl << std::endl << std::endl << std::endl;

	return true;
}

void GMClientDc::Write(SocketMessage* sm)
{
	sm->WriteString("GMClientDc");
	sm->WriteInt(m_id);
	sm->WriteInt(TheTimerMS::Instance()->GetTimeMS());
}

void GMClientDc::SetID(int i)
{
	m_id = i;
}

int GMClientDc::GetID() const
{
	return m_id;
}